
package rest.jbpm.wrappers;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import rest.jbpm.wrappers.refs.DeploymentRef;

@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(name = "processDefinition", propOrder = {
    "id",
    "key",
    "name",
    "description",
    "imageResourceName",
    "version",
    "suspended",
    "deployment"
})
public class Definition {

    protected org.jbpm.api.ProcessDefinition definition;
	private String baseUri;
    
    protected Definition() {
    	
    }
    
    public Definition(org.jbpm.api.ProcessDefinition definition, String baseUri) {
    	this.definition = definition;
    	this.baseUri = baseUri;
    }

    @XmlElement(required = true)
    public String getId() {
        return definition.getId();
    }

    @XmlElement(required = true)
    public String getKey() {
        return definition.getKey();
    }

    @XmlElement(required = true)
    public String getName() {
        return definition.getName();
    }

    @XmlElement(required = false)
    public String getDescription() {
        return definition.getDescription();
    }

    @XmlElement(required = false)
    public String getImageResourceName() {
        return definition.getImageResourceName();
    }

    @XmlElement(required = true)
    public int getVersion() {
        return definition.getVersion();
    }

    @XmlElement(required = false)
    public boolean isSuspended() {
        return definition.isSuspended();
    }

    @XmlElement(required = true)
    public DeploymentRef getDeployment() {
        return new DeploymentRef(definition.getDeploymentId(), baseUri);
    }
 
}
